<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets the level(s) to be logged</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="mongolog.setcallback.html">« MongoLog::setCallback</a></li>
      <li style="float: right;"><a href="mongolog.setmodule.html">MongoLog::setModule »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.mongolog.html">MongoLog</a></li>
    <li>Sets the level(s) to be logged</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="mongolog.setlevel" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoLog::setLevel</h1>
  <p class="verinfo">(PECL mongo &gt;= 1.2.3)</p><p class="refpurpose"><span class="refname">MongoLog::setLevel</span> &mdash; <span class="dc-title">Sets the level(s) to be logged</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongolog.setlevel-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>MongoLog::setLevel</strong></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$level</code></span>): <span class="type"><span class="type void">void</span></span></div>

  <p class="para rdfs-comment">
   This function can be used to control logging verbosity and the types of
   activities that should be logged. The
   <a href="class.mongolog.html#mongolog.constants.level" class="link">MongoLog level constants</a>
   may be used with bitwise operators to specify multiple levels.
  </p>
  <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">//&nbsp;first,&nbsp;specify&nbsp;a&nbsp;logging&nbsp;module<br /></span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">setModule</span><span style="color: #007700">(</span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">CON</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;log&nbsp;messages&nbsp;for&nbsp;every&nbsp;level<br /></span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">setLevel</span><span style="color: #007700">(</span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">ALL</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;log&nbsp;warning&nbsp;and&nbsp;info&nbsp;messages&nbsp;only<br /></span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">setLevel</span><span style="color: #007700">(</span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">WARNING</span><span style="color: #007700">|</span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">INFO</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;log&nbsp;everything&nbsp;except&nbsp;fine&nbsp;activity<br /></span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">setLevel</span><span style="color: #007700">(</span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">ALL&nbsp;</span><span style="color: #007700">&amp;&nbsp;(~</span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">FINE</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
  </div>

  <p class="para">
   Note that you must also call <span class="function"><a href="mongolog.setmodule.html" class="function">MongoLog::setModule()</a></span> to
   specify which modules(s) of the driver should log.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mongolog.setlevel-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    
     <dt>

      <code class="parameter">level</code>
     </dt>

     <dd>

      <p class="para">
       The level(s) you would like to log.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

</div></div></div></body></html>